Skip to content

Conversation

@HansOlsson
Copy link
Collaborator

I believe this handles all of the case, but there might be some remaining issue.

@HansOlsson HansOlsson linked an issue Sep 30, 2025 that may be closed by this pull request
@HansOlsson HansOlsson added this to the 2025-October milestone Oct 1, 2025
@HansOlsson
Copy link
Collaborator Author

I believe the updated handling of overdetermined connectors works, and to me is short and fairly intuitive.
I understand it can be formulated in different ways, but I don't see any alternative that will be as easy to handle.

For the perfect matching I believe it is best discussed in #3763 - and some restriction added later.

@HansOlsson
Copy link
Collaborator Author

As far as I can see this improves the situation for:

  • overdetermined connectors (when doing a local check and there are sub-components with overdetermined connectors).
  • expandable connectors

With fairly small changes. It would be possible to formulate in various other ways, but I believe they will be equivalent - and I don't see any alternative that is clearly easier to understand.

Note that we have improved the local check for these cases for Dymola 2026x (in particular when checking models with partial components which requires a local check, the usual balancing-error-pin-pointing is primarily an inclusive check according to the terminology in
#3750 (comment) ); so I'm fairly confident that it actually works.

@HansOlsson HansOlsson modified the milestones: 2025-October, 2025-November Nov 5, 2025
For each declared component of specialized class \lstinline!connector! component, it is the number of unknown variables inside it (i.e., excluding parameters and constants and counting the elements after expanding all records and arrays to a set of scalars of primitive types).
\item
For each declared component of specialized class \lstinline!block! or \lstinline!model!, it is the sum of the number of inputs and flow variables in the (top level) public connector components of these components (and counting the elements after expanding all records and arrays to a set of scalars of primitive types).
If these public connector components contain overdetermined connectors each instance of an overdetermined type or record in that connector is assumed to be a separate root.
Copy link
Collaborator

@qlambert-pro qlambert-pro Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is overly abstract and as I explained before the only way I am signing off on it is if other people prefer this formulation to what I proposed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So that others can find that alternative (which responded to a previous variant of this text):

An alternative to the count here is:

  • For over-determined variables and equations, where the cardinality of the type is c and the size of the residual is n:
    • Over-determined connector variables are counted as n variables.
    • Declaration and equality equation of over-determined type are counted as c.
    • Connections.root and Connections.branch are counted as adding n - c equations.
    • Connections.potentialRoot is counted as adding n - c if the root is selected and 0 otherwise.
    • Generated potential equations are counted as adding n equations.

Originally posted by @qlambert-pro in #3750 (comment)

I have a hard time understanding how that description really works, as Connections.root and Connections.potentialRoot don't directly contribute to the global equation count (for potentialRoot there is normally an if-equation based on whether it is selected as root or not).

However, I can understand that this problem is abstract and complicated to get right.

The following are four cases that seem to covert this:

  • A root-less component with one over-determined connector, like Modelica.Mechanics.MultiBody.Forces.WorldForce
  • A component with a root and one over-determined connector, like a simplified Modelica.Mechanics.MultiBody.Parts.Body
  • A (root-less) component with a pair of over-determined connectors connected to similar ones in a sub-component, like Modelica.Mechanics.MultiBody.Forces.Spring
  • A (root-less) component with a pair of over-determined connectors connected to similar ones in two sub-component (like a parallel Spring and Damper variant built by components).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local balance, connect equations and over-determined connectors.

3 participants